class AddController < ApplicationController
  verify :params => :text ,:render => {:text => "Input Error: text パラメータが指定されていません．"}
  
  def index
    data = Array.new
    data << {"id" => 1,"title" => "A","text" => "Adata"}
    data << {"id" => 2,"title" => "B","text" => "Bdata"}
    results = {"results" => 2,"jdata" => data}
    render_json results,:callback => params[:callback]
  end
  
  require 'kconv'
  require 'nkf'  
  def check_code_of
    @CODES = {
      NKF::JIS      => "JIS",
      NKF::EUC      => "EUC",
      NKF::SJIS     => "SJIS",
      NKF::BINARY   => "BINARY",
      NKF::UNKNOWN  => "判別失敗",
      NKF::ASCII    => "ASCII",
      NKF::UTF8   => "UTF-8",
      NKF::UTF16    => "UTF-16",
    }
    render :text => "CODE: #{@CODES[NKF.guess(params[:text])]}"
  end
  
end